package com.example.meeting.mapper;

import com.example.meeting.model.domain.Admin;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminMapper {
    //查询管理员
    @Select("SELECT * FROM admin where id=#{id}")
    Admin selectAdminById(Long id);

    //动态查询管理员列表
    List<Admin> selectAdminList(Admin admin);

    //新增管理员
    @Insert("INSERT INTO admin(username,password) VALUES(#{username},#{password})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    Integer addAdmin(Admin admin);

    //更新管理员
    Integer updateAdmin(Admin admin);

    //删除管理员
    @Delete("DELETE FROM admin where id=#{id}")
    Integer deleteAdmin(Long id);

    //登录认证接口(只查询用户名密码)
    @Select("SELECT id,username,password FROM admin WHERE username=#{username}")
    Admin authenticationByUsername(String username);
}
